<%@ include file="/en/jsp/static.jsp" %>
<%@ page import="java.util.*, linuxbox.filelib.logic.*,linuxbox.admin.logic.*" %>
<%@ taglib uri="/linuxbox/common.tld" prefix="common" %>

<jsp:include page="/en/jsp/header.jsp" flush="true"/>

<%
  FileLibHome home = FileLibHome.getInstance();
  FileLibEntry entry = (FileLibEntry)session.getAttribute("filelib.CURENTRY");
  if (entry == null)
  {
    pageContext.forward(BoxStatic.errorJSP);
    return;
  }

  if (!home.checkAccessRights(curID, entry, home.BROWSE_ALLOW))
  {
    pageContext.forward(BoxStatic.accessRightErrorJSP);
    return;
  }

  String location;
  if (entry.getID() == home.ROOT)
    location = home.getPathString(entry.getID());
  else
    location = home.getPathString(entry.getParent());
  UserManager um = UserManager.getInstance();

%>

<table width="100%" height=26 align=middle border=0 cellpadding=0 cellspacing=0 bgcolor="#f4f4f4" style="font-size:16px;color:#d05000">
  <tr>
    <td>
	    &nbsp;<img src="<%=BoxStatic.imageDir%>itemball.jpg" width=14 height=15 border=0 align="absmiddle">
	    <b><%=boxName%> - File Library&nbsp; - View Folder</b>
    </td>
    <td align=right>
      <a href="<%=BoxStatic.servletDir%>BoxFileLibSettingsAction?SubmitEdit=edit">
        Settings
      </a>
    </td>
  </tr>
</table>
<hr width=\"100%\" color=#E06000 align=left>

  <table width= "100%" border=1 cellspacing=0 cellpadding=1>
<form action="<%=BoxStatic.servletDir%>EditFolderAction" method=post>
    <TR>
      <TD colSpan=2> <font size="+1">Viewing folder: <B><%=home.getPathString(entry.getID()) %></B></font>
      </TD>
    </TR>
    <TR bgcolor="#7EC1F3">
      <TD colSpan=2> <B>General:</B>
      </TD>
    </TR>
    <tr><td>
      <table border=0 width="100%" bgcolor=#e0e0e0 style="font-size:14px">
          <input type=hidden name=ID value=<%=entry.getID()%>>
          <tr><td colspan="2">
            <input type=button value=Close onclick="window.history.go(-1)" >
<%
  if ((entry.getID() != home.ROOT) && home.checkAccessRights(curID, entry, home.WRITE_ALLOW))
  {
        out.println("<input type=submit value=\"Delete\" name=SubmitAskDelete>");
        out.println("<input type=submit value=\"Edit\" name=SubmitEdit>");
  }
%>
          </td></tr>
          <tr>
            <td>Owner: <b><%=um.getUserDisplayName(entry.getOwnerid(), um.USERNAME_FORMAT_ALL)%></b></td>
            <td>
            <b>
<%
  if ((entry.getAttributes()&home.READONLY) != 0)
    out.print("Readonly");
  else
    out.print("Not readonly");
%>
              </b>
            </td>
          </tr>
          <tr>
            <td>
              Create time: <b><%=entry.getCreatetimeString()%></b>
            </td>
            <td>
              Last modified time: <b><%=entry.getLastmodifiedtimeString()%></b>
            </td>
          </tr>
          <tr><td  colspan=2>
            Description:<br>
            <textarea name=DESCRIPTION rows=5 cols=60><%=((entry.getDescription()==null)?"":entry.getDescription())%></textarea><br>
          </td></tr>
      </table>
    </td></tr>
    <TR bgcolor="#7EC1F3">
      <TD colSpan=2> <B>Security:</B>
      </TD>
    </TR>
</form>

    <tr><td>
      <table border=0 width="100%" bgcolor=#e0e0e0 style="font-size:14px">
          <tr><td>
            <b>
<%
  if ((entry.getAttributes()&home.INHERIT) != 0)
  {
    out.print("Inherit from parent");
  }
  else
    out.print("Not inherit from parent");
%>
            </b>
          </td></tr>
          <tr><td >
            <b>Permissions:</b><br>
        <select name="PERMISSIONS" size="5" multiple>
<%
  Collection col = home.getPermissionList(entry);
  Iterator it = col.iterator();
  int i = 1;
  while (it != null && it.hasNext())
  {
    PermissionEntry permission = (PermissionEntry)it.next();
    if (permission != null)
    {
      out.print("<option value=");
      out.print(i++);
      out.print(">");
      out.print(home.getPermissionString(permission));
      out.print("</option>");
    }
  }
%>
</select>
          </td></tr>
      </table>
    </td></tr>
  </table>

  <hr width=\"100%\" color=#E06000 align=left>

<jsp:include page="/en/jsp/footer.jsp" flush="true"/>
